<!-- 商品基本信息组件 -->
<template>
  <div v-if="Object.keys(baseInfo).length !== 0" class="base-info">
    <div class="info-price">
      <span class="price-now">{{ nowPrice }}</span>
      <span v-if="baseInfo.originPrice != Infinity" class="price-origin">
        {{ originPrice }}
      </span>
    </div>
    <p class="info-title">{{ baseInfo.title }}</p>
    <div class="info-num">
      <span class="info-like">{{ baseInfo.likeNum }}</span>
      <span class="info-sale">已售{{ baseInfo.saleNum }}件</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  props: {
    baseInfo: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  data() {
    return {};
  },
  computed: {
    nowPrice() {
      return "¥" + this.baseInfo.nowPrice;
    },
    originPrice() {
      return "¥" + this.baseInfo.originPrice;
    }
  },
  components: {}
};
</script>

<style scoped>
.base-info {
  background: #fff;
  padding: 10px;
}
.price-now {
  display: inline-block;
  color: #333;
  font-size: 25px;
  margin-right: 10px;
}
.price-origin {
  display: inline-block;
  color: #999;
  font-size: 14px;
  text-decoration: line-through;
}
.info-title {
  margin: 10px 0;
  line-height: 1.5rem;
}
.info-num {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.info-like {
  padding-left: 16px;
  background: url("~@/assets/img/common/like.svg") no-repeat center left;
  background-size: 13px 13px;
}
</style>
